package com.jiexin.util;

import org.apache.commons.lang3.StringUtils;

/**
 * @Author: Jay_Liu
 * @Description:
 * @Date: Created in 19:58 2018/4/3 0003
 * @Modified By:
 */
public class LevelUtil {

    //分隔符
    public final static String SEPARATOR = "." ;

    //原始Id
    public final static String ROOT = "0";

    //部门等级计算规则
    //0
    //0.1
    //0.1.2
    //0.1.3
    //0.4
    public static String calculateLevel(String parentLevel, int parentId){
        if (StringUtils.isBlank(parentLevel)) {
            return ROOT;
        } else {
            return StringUtils.join(parentLevel, SEPARATOR, parentId);
        }
    }
}
